﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class View_CIB_CIB001_Summary : ViewMatrix //ViewCIB001 //System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        criteriaList = new string[] { "Criteria", "GroupBy", "ExclusiveOfAccount","Unit","AccNo" };

        serviceName = "MISAPP.Classify.Service.Service_CIB001";
        //btn2Excel.PageParameter = "method=GetCIB001SummaryData&xls=CIB001&service=Service_CIB001";
        btn2Excel.PageParameter = "method=GetSummaryData&xls=CIB001&service=Service_CIB001";
        if (!IsPostBack)
        {
            GetData();
        }        
    }

    protected void GetData()
    {
        string groupByList = Session["GroupBy"] as string;
        System.Data.DataTable dt = GetDataFromSerevice("GetSummaryData"); //GetSummaryData();
        CLB_Summary.PageSize = GetGridViewPageSize();
        string[] lst = groupByList.Split(new Char[]{','}) ;
        CLB_Summary.SetData(dt ,lst);        
    }

    protected void CLB_Summary_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName.Equals("detail"))
        {
            serviceName = "MISAPP.Classify.Service.Service_CIB001";
            criteriaList = new string[] { "key", "Criteria", "ExclusiveOfAccount" };

            Session["key"] = CLB_Summary.SelectKeyValue;
            
            FillToSession();
            string strPage,pageParameter;
            pageParameter = "method=GetDetailData&xls=CIB001_Detail&service=Service_CIB001";
            strPage = string.Format("../GV2XLS.aspx?{0}",pageParameter) ;

            Server.Transfer(strPage);
                    
        }
    }

    protected void btn2Excel_Click(object sender, EventArgs e)
    {
        FillToSession();
    }

    protected void CLB_Summary_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        GetData();
    }

    protected void CLB_Summary_Sorting(object sender, GridViewSortEventArgs e)
    {
        GetData();
    }

    protected void CLB_Summary_DataBound(object sender, EventArgs e)
    {
        CLB_Summary.AddNotSort("SEQ", 1);
        CLB_Summary.AddNotSort("REC", 2);
    }
}